[python] parsing a string based on specified identifiers

Posted by jml on Stack Overflow See other posts from Stack Overflow or by jml
Published on 2010-05-11T22:44:02Z Indexed on 2010/05/11 22:44 UTC
Read the original article Hit count: 190

Filed under:
|
|

Let's say that I have the following text:

in = "one aaa two bbbb three cccc"

I would like to parse this into a group of variables that contain

notworking = ["one", "two", "three"]

v1,v2,v3 = in.split(notworking)

I know that the example above won't work, but is there some utility in python that would allow me to use this sort of approach? I know what the identifiers will be in advance, so I would think that there has got to be a way to do this...

Thanks for any help, jml

© Stack Overflow or respective owner

Related posts about python

Related posts about string